<template>
	<view class="container">
		<cc-gonggeGrid gridTitle="设置录音" gridNum="3" :gridList="gridList" @gridClick="gridClick"></cc-gonggeGrid>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				uuid: '',
				gridList: [{
						name: 'alert',
						displayName: '报警'
					},
					{
						name: 'other',
						displayName: '其他'
					},
					{
						name: 'drink',
						displayName: '喝水'
					},
					{
						name: 'eat',
						displayName: '吃饭'
					},
					{
						name: 'pill',
						displayName: '吃药'
					},
					{
						name: 'pop',
						displayName: '大便'
					},
					{
						name: 'pee',
						displayName: '小便'
					},
				]
			};
		},
		onLoad(options) {
			console.log('Options received:', options);
			if (options.uuid) {
				this.deviceUUID = options.uuid;
				console.log('Received uuid:', this.deviceUUID);
			} else {
				console.log('No uuid received');
			}
		},
		methods: {
			gridClick(item, index) { //格子菜单点击事件
				console.log('item = ' + item.name + ',index = ' + index);
				const uuid = this.deviceUUID;
				uni.navigateTo({
					url: `/pages/setvoice/setvoice?type=${encodeURIComponent(item.name)}&uuid=${uuid}`,
				})
			},
		}
	}
</script>


<style>
	.record-container {
		margin-bottom: 20px;
	}
</style>